package com.slz3.business.module.configManagement.conZoneType.steward;

import com.slz3.business.frame.response.RR;
import com.slz3.business.frame.response.ResInfo;
import com.slz3.business.module.configManagement.conZoneType.domain.ConZoneType;
import com.slz3.business.module.configManagement.conZoneType.domain.ConZoneTypeCondition;
import org.springframework.stereotype.Controller;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;

import javax.annotation.Resource;

@Controller
public class ConZoneTypeResController {

    @Resource
    private ConZoneTypeResAtomic conZoneTypeResAtomic;

    public Mono<ServerResponse> add(ServerRequest req, ConZoneType conZoneType) {
        if (ConZoneTypeResUnsafeValid.add(req, conZoneType)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.add_$ConZoneTypeUpdateLock(req, conZoneType);
        }
    }

    public Mono<ServerResponse> delete(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        if (ConZoneTypeResUnsafeValid.delete(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.delete_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

    public Mono<ServerResponse> modify(ServerRequest req, ConZoneType conZoneType) {
        if (ConZoneTypeResUnsafeValid.modify(req, conZoneType)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.modify_$ConZoneTypeUpdateLock(req, conZoneType);
        }
    }

    public Mono<ServerResponse> list(ServerRequest req) {
        if (ConZoneTypeResUnsafeValid.list(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneTypeResExecutor.list(req);
        }
    }

    public Mono<ServerResponse> info(ServerRequest req) {
//        return conZoneTypeResAtomic.info_$ConZoneTypeUpdateLock(req);
        if (ConZoneTypeResUnsafeValid.info(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.info_$ConZoneTypeUpdateLock(req);
        }
    }

    public Mono<ServerResponse> choice(ServerRequest req) {
        if (ConZoneTypeResUnsafeValid.choice(req)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return ConZoneTypeResExecutor.choice(req);
        }
    }

    public Mono<ServerResponse> auditSubmit(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        //
        if (ConZoneTypeResUnsafeValid.auditSubmit(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.auditSubmit_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

    public Mono<ServerResponse> audit(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        if (ConZoneTypeResUnsafeValid.audit(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.audit_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

    public Mono<ServerResponse> auditReject(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        if (ConZoneTypeResUnsafeValid.auditReject(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.auditReject_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

    public Mono<ServerResponse> usingEnable(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        if (ConZoneTypeResUnsafeValid.usingEnable(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.usingEnable_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

    public Mono<ServerResponse> usingDisable(ServerRequest req, ConZoneTypeCondition conZoneTypeCondition) {
        if (ConZoneTypeResUnsafeValid.usingDisable(req, conZoneTypeCondition)) {
            return RR.error(req, ResInfo.builder().theme(RR.UN_SAFE_VALID).description(RR.ILLEGAL_PARAM).build());
        } else {
            return conZoneTypeResAtomic.usingDisable_$ConZoneTypeUpdateLock(req, conZoneTypeCondition);
        }
    }

}
